const http = require('../../utils/http.js');   //相对路径
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    
  },
  attached: function () {
    http.postRequest('/mini/v1/home/technician', {}, res=>{
      this.setData({
        notice_count: res.data.notice_count
      })
    })
  },
  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () { },
    hide: function () { },
    resize: function () { },
  },

  /**
   * 组件的初始数据
   */
  data: {
    infoData: [],
    listInfo:'',
    focus: false,
    seekInput: '',
    notice_count: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 获取焦点
    Blurinput() {
      this.triggerEvent('twoLevelCommentBtn1', true);
      this.setData({
        focus: true
      })
    },
    // 输入取消
    phoneOnBlur() {
      this.triggerEvent('twoLevelCommentBtn1', false);
      this.setData({
        focus: false,
        seekInput: '',
        infoData: []
      })
    },
    seek(e) {
      if(e.detail.value) {
        http.postRequest('/mini/v1/car_owner/search',{search: e.detail.value},res=> {
          if(res.data) {
            this.setData({
              infoData: res.data
            })
          }
          
        })
      }
    },
    getData(e){
      this.setData({
        infoData:[],
        focus: false,
        seekInput: '',
        listInfo:e.currentTarget.dataset.info
      })
      this.triggerEvent('twoLevelCommentBtn1', false);
      wx.navigateTo({
        url: '/pages/openOrder/repair/repair?item='+ JSON.stringify(e.currentTarget.dataset.info)
      })
    },
    openCamera(){
      wx.navigateTo({
        url: '/pages/scan/scan',
      })
    },
    gopage() {
      wx.navigateTo({
        url: '/pages/index/child/message',
      })
    }
  }
})
